package com.tao.controller;

import com.tao.mapper.UserMapper;
import com.tao.pojo.dto.UserDTO;
import com.tao.pojo.vo.UserVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    UserMapper userMapper;
    @RequestMapping("/login")
    public int login(@RequestBody UserDTO userDTO){
        System.out.println("userDTO = " + userDTO);
        UserVO userVO = userMapper.selectByUsername(userDTO.getUsername());
        if (userVO!=null){
            if (userVO.getPassword().equals(userDTO.getPassword())){
                return 1;
            }
            return 3;
        }
        return 2;
    }
}
